﻿package com.tudou.utils
{

    public class VideoURL extends Object
    {

        public function VideoURL()
        {
            return;
        }// end function

        public static function getVideoId(param1:String) : uint
        {
            var _loc_2:* = /itemid=(\d+)""itemid=(\d+)/ig;
            var _loc_3:* = _loc_2.exec(param1);
            if (_loc_3)
            {
                return _loc_3[1];
            }
            return 0;
        }// end function

        public static function addSourceId(param1:String, param2:String) : String
        {
            var replFun:Function;
            var url:* = param1;
            var sourceId:* = param2;
            replFun = function () : String
            {
                arguments = arguments[0];
                arguments = arguments + (arguments.charAt((arguments.length - 1)) == "?" ? (sourceId + "&") : ("?" + sourceId));
                return arguments;
            }// end function
            ;
            var reg:* = /\.(flv|f4v|m4v|mp4)\??""\.(flv|f4v|m4v|mp4)\??/i;
            return url.replace(reg, replFun);
        }// end function

    }
}
